package com.leador.map.location.serviceserver;

import android.os.StrictMode;
import android.os.StrictMode.ThreadPolicy;
import android.os.StrictMode.ThreadPolicy.Builder;

import com.leador.map.location.Const;

public class Utils {
    private Utils() {
        //
    }

    /**
     * 开启STRICTMODE
     *
     */
    public static void strictMode() {
        if (!Const.bDebug) {
            return;
        }
        int iSdk = android.os.Build.VERSION.SDK_INT;
        if (iSdk > 8) {
            com.leador.map.location.util.Utils.writeCat("server|enable strict mode");
            Builder builderT = new StrictMode.ThreadPolicy.Builder();
            builderT.detectDiskReads().detectDiskWrites();
            builderT.detectNetwork().penaltyLog();
            ThreadPolicy tp = builderT.build();
            StrictMode.setThreadPolicy(tp);
            android.os.StrictMode.VmPolicy.Builder builderV = new StrictMode.VmPolicy.Builder();
            builderV.detectLeakedSqlLiteObjects();
            builderV.penaltyLog();
            builderV.penaltyDeath();
            StrictMode.setVmPolicy(builderV.build());
        } else {
            com.leador.map.location.util.Utils.writeCat("server|no support strict mode");
        }
    }
}